Crypto
badkey1
import string
from Crypto.Util.number import *
from gmpy2 import *
from pwn import *
from hashlib import *
from string import *
from tqdm import *
from Crypto.PublicKey import RSA
from random import choice
host = '39.107.137.13'
port = 35786
conn = remote(host, port)
conn.interactive()
import string
from Crypto.Util.number import *
from gmpy2 import *
from pwn import *
from hashlib import *
from string import *
from tqdm import *
c = 'XXXX+kj1UXEX0q7Jlm052'
h = 'c714e09e3911b5228059b9060b85f7f67f31f9552643d31f786530a7523681e8'
h = h[:10]
str = string.ascii_letters + string.digits
s = ''
c1 = c
for i in tqdm(range(62)):
for j in range(62):
for m in range(62):
for n in range(62):
c2 = c1
s = str[i] + str[j] + str[m] + str[n]
c2 = c2.replace('XXXX+',s)
c3 = sha256(c2.encode()).hexdigest()
if(c3[:10] == h):
print(s)
print(c2)
break
import string
from Crypto.Util.number import *
from gmpy2 import *
from pwn import *
from hashlib import *
from string import *
from tqdm import *
nbits = 512
e = 65537
def findq():
for i in range(2,e):
g,x,y = gcdext(e*p,-i*(p-1))
if g!=1:
continue
q = y + 1
if(q.bit_length() == 512 and isPrime(q)):
return q
return None
for i in tqdm(range(1000)):
p = getPrime(nbits)
q = findq()
if q is not None:
phi = (p-1)*(q-1)
d = inverse(e,phi)
print(f'p = {p}')
print(f'q = {q}')